Skip to content

Fix guided start when a Goal registration is missing locally - #9115

Open
hhyykk wants to merge 1 commit into
mainfrom
codex/guided-missing-goal-registration
Open

hhyykk wants to merge 1 commit into
mainfrom
codex/guided-missing-goal-registration

Conversation

@hhyykk

@hhyykk hhyykk commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Problem

When the project registry has no matching Goal entry and the shared registry still points that Goal at the same project registry, guided start advertised a fresh connection. Bootstrap later refused the write because the existing authority remained.

Fix

Reuse the existing orphaned-Goal gate when the Goal ID and source registry match. The preview directs the operator to restore the original project registration and keeps the read-only inspection and backup previews. Another repository's shared registration does not trigger this gate.

This is a follow-up to the audit in #9113. It shares the command-pack file with the refactor in #8891 and adds a missing-registration case to the existing fence.

Verification

  • The two exact-source cases failed before the fix. The two different-source cases continued to offer normal bootstrap.
  • After the fix, 198 tests passed and 1 was skipped across the orphaned-state, guided packet, platform and host-activation suites.
  • Ruff passed on all changed Python files. The tests verify that the shared registry bytes remain unchanged.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T02:35:30.853736Z f105287 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent | gpt-6.1-sol | OpenAI | runtime_reported | low

动机 / Motivation

真实用户项目恢复与已安装服务仍未验证;#9115 还需修复 registry I/O 清单缺失。

在项目本地 Goal 登记缺失后,通过 start-goal guided flow 或 bootstrap command pack 恢复原任务的操作者和 Agent。只有本地残留 ACTIVE_GOAL_STATE 才触发 orphan fence;共享登记仍指向本项目但本地登记消失时,guided 输出仍建议 connect,随后实际 bootstrap 拒绝。相同 Goal id 和相同 source_registry 留在共享登记、本地无该条目时,base 提供 connect_if_needed,head 只提供 inspect_connection 与 resolve_orphaned_goal_state;不同项目的相同 id 仍允许原 onboarding。在原入口提前准确解释恢复阻塞并指向恢复原项目登记,消除一次注定被拒绝的连接尝试;不写共享登记、不创建第二份 Goal。

规格按 immutable base 的 docs/architecture/rfcs/goal-instance-identity-and-orphan-recovery-v0.md 核对:source-registry-authority、stale-route-not-write-authority;只采用已接受 source authority 与现有 fence 边界,不把未来激活设计作为新增义务。参照基点 8e9a28a866da06cc6fd63e78709910fe35dad564,本次检查 head f1052874094c5dee44cb99d8edee22bcd5fdc641。不实现新的 orphan 身份协议、自动备份或恢复,不从共享投影授予写权,不宣称已部署或全局恢复系统验收完成。

改动思路 / Approach

复用 absent_goal_connection 与已有 orphan fence,新增的共享登记检查仅提供保守的缺失登记诊断;same_source_registry 仍拥有路径等价判断,原 bootstrap 继续拥有实际写入权限。本 PR 仅补齐两个既有构建入口对已存在同项目共享登记的恢复提示和阻断,不重建 Goal identity owner。已有 owner 足够,修补其输入边界比新增协议或状态机更小。未将共享投影、缓存 hint、测试数或历史评审当成实际写权或已部署结果。

默认 guided 提示对同项目同 Goal 残留共享登记更保守;不新增配置、持久字段或写入权。完整检查了生产变更、helper 定义、调用方与测试,不新增领域专用的通用 Goal 义务,也没有 opt-in/default-off 声称。

具体改动 / Changes

_inspect_bootstrap_connection(loopx/bootstrap_command_pack.py):解析显式 runtime root 后把共享登记路径交给全部 absence 分支。

_global_registration_projection(loopx/control_plane/goals/orphaned_goal_state.py):同时匹配 Goal id 与 canonical source_registry,只返回诊断 gate。

fence_command_pack(loopx/control_plane/goals/orphaned_goal_state.py):复用白名单保留 status,撤下连接、注册、Todo、quota 和 host activation continuation。

正向路径:同项目同 Goal 残留共享登记、无本地状态文件:真实 guided builder 从 connect 提示变为只读 fence;路径别名也识别,221 项登记中的目标也识别。

反向与恢复路径:其他项目同 id、其他 id、新 Goal、共享文件缺失或不可解析均保持原 onboarding;本地登记恢复后实际 builder 返回 connected 且撤下 gate。

定向 pytest 27 passed、1 skipped,16 个 base/head builder 对照和恢复到 connected 通过。semantic smoke 在 base exit0、head exit1,确认新增直接 registry I/O 未分类,阻止批准。对照使用相同输入类别、真实临时文件和明确 source-checkout provenance;基点用 immutable module 装载,未运行活跃用户 Goal。未查询 CI,review 结论与 merge readiness 分开。

对主干的风险 / Risks

[P2] 新增 registry 读取缺少分类清单:_global_registration_projection 在 loopx/control_plane/goals/orphaned_goal_state.py:110 调用 read_json(shared_registry),但本 PR 没有更新 registry I/O 分类与生成清单。安装根目录 TypeScript 依赖后,python examples/semantic-vocabulary-drift-smoke.py 在 immutable base 通过、该 head 失败,错误为 unclassified direct project registry I/O ... _global_registration_projection::direct_json_read:read_json#1,standard premerge 因此仍失败。请审阅并注册该调用点、更新生成清单后重跑检查;不能用放宽 gate 或删除扫描规避。

最强回归反例是 同项目残留登记阻止误导性 connect,其他 source/id 不被错误拦截。 无法成立。对照的旧行为为:base 对同项目残留共享登记仍返回 not_connected/connect_if_needed。新行为为:head 返回 orphaned_goal_state,仅两项只读步骤;其他 source/id 与 base 相同。。这些观察支持有意差异,同时保留负例边界。回退该局部逻辑无需持久状态迁移。

未实际执行用户项目的恢复、backup --execute 或 host activation;测试仅使用临时项目、隔离 canonical store 和真实 builder。共享登记读取失败保持原行为,并不能证明没有远端记录,实际 bootstrap 仍负责拒绝。没有组件、网页首屏或 Lark 消息内容改动,故截图不适用;真实服务和平台限制仍保留,不能从本地构建或模拟恢复结果推出已上线资格。

我的整体评价 / Verdict

REQUEST_CHANGES:恢复行为修复本身有证据支持,但新增 registry I/O 缺少分类使 required gate 失败,需先补齐。复用 absent_goal_connection 与已有 orphan fence,新增的共享登记检查仅提供保守的缺失登记诊断;same_source_registry 仍拥有路径等价判断,原 bootstrap 继续拥有实际写入权限。本 PR 仅补齐两个既有构建入口对已存在同项目共享登记的恢复提示和阻断,不重建 Goal identity owner。在原入口提前准确解释恢复阻塞并指向恢复原项目登记,消除一次注定被拒绝的连接尝试;不写共享登记、不创建第二份 Goal。这是一项有实际调用者和独立正反例的有限修补,避免为局部恢复问题扩展新的公共协议或状态 owner。

定向 pytest 27 passed、1 skipped,16 个 base/head builder 对照和恢复到 connected 通过。semantic smoke 在 base exit0、head exit1,确认新增直接 registry I/O 未分类,阻止批准。不实现新的 orphan 身份协议、自动备份或恢复,不从共享投影授予写权,不宣称已部署或全局恢复系统验收完成。进一步跨 owner 重构和真实服务升级应沿已有验收与权限边界,不因本次 review 自动获得资格。

English verdict: REQUEST_CHANGES — f105287; the new direct registry read is unclassified and fails the semantic gate on head while the same check passes on base. Register the read and regenerate the manifest before re-review. Live deployment and the explicitly untested platforms are not qualified by this review.

shared_registry: Path, source_registry: str, goal_id: str,
) -> dict[str, Any] | None:
try:
global_payload = read_json(shared_registry)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 请登记新增直接 registry I/O。相同依赖下 semantic-vocabulary-drift-smoke 在 base 通过、此 head 因 _global_registration_projection::direct_json_read:read_json#1 未分类失败,standard premerge 因此阻断。请审核并补齐 project_registry_io_classifications_v1.json 与生成清单,再重跑检查。

@mergify

mergify Bot commented Nov 20, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @hhyykk.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 20, 2026

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

从 Codex App 或 CLI 恢复既有 Goal 的使用者,有时会遇到本地登记丢失、共享登记仍指向原项目的情况。 旧版的引导预览仍提供连接步骤,直到真正写入才被已有登记拒绝。新版在预览中直接指出要恢复原登记。 实际 CLI 对同一路径的共享登记返回恢复门禁,对不同项目路径仍提供普通连接,四组对照均保持登记文件原样。 本次修复引导预览及其既有恢复门禁,恢复登记和 Goal 生命周期仍由原负责人处理。

改动思路 / Approach

沿用原有孤立 Goal 的门禁,增加同一 Goal ID 和项目登记路径的匹配。共享登记只负责说明为什么应恢复原入口;引导阶段保留既有只读检查和备份预览。没有新增 Goal 状态、权威写入或另一套恢复流程。可以把新增共享读取衔接到已有登记 I/O owner,避免为一个预览维护第二个读取边界。

具体改动 / Changes

依据主干原有的启动恢复流程和登记 I/O 审核规则检查这次修复。启动流程 · 语义检查契约

  • GUIDED-SAME-SOURCE 已实现。独立执行基线和当前提交的 start-goal --guided。当本地登记缺失或只有其他 Goal 时,旧版仍给出 connect_if_needed,当前提交改为 orphaned_goal_state 和只读恢复步骤。
  • GUIDED-OTHER-SOURCE 已实现。相同 Goal ID 指向不同项目时保留普通连接预览。八次基线和当前提交的调用均保持本地、共享登记文件字节不变,也没有写入或扣额。
  • REGISTRY-IO 当前快照未满足。语义 smoke 在基线通过,在当前提交报告 _global_registration_projection::direct_json_read:read_json#1 未分类。

对主干的风险 / Risks

P2 登记读取缺少持久分类。 当前引导修复有效,阻断点是新增的 read_json(shared_registry)。我独立复现了前次评审的失败,并核对了实际修法。可复用合适的登记读取 owner,或在现有 project_registry_io_classifications_v1.json 审阅并登记稳定的直接调用位点。I/O census 由 smoke 从跟踪源码生成,导出是诊断用途,无需提交生成文件。完成后重跑 python examples/semantic-vocabulary-drift-smoke.py 及引导正反例。

通过 20 项目标测试、Ruff 和上述 CLI 对照。当前提交的语义检查仍失败。远端 CI 未检查。

我的整体评价 / Verdict

检查了 start-goal 的 CLI JSON、实际引导文案和只读恢复步骤,改动没有渲染页面。 未跑安装版 App、实际登记恢复写入或全部宿主激活组合。 当前已独立审阅 f1052874094c5dee44cb99d8edee22bcd5fdc641,保留变更请求。基线的全树语义检查通过,精确提交因新增直接 I/O 缺少分类而失败。

English verdict: REQUEST_CHANGES

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Mergify: the pull request has merge conflicts with its base branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants